package com.hckj.jianzhijia.model;

import android.os.Parcel;
import android.os.Parcelable;

import com.avos.avoscloud.AVObject;
import com.avos.avoscloud.AVUser;

import java.io.Serializable;
import java.util.Date;

/**
 * Created by 赵奇隆 on 2015-10-27.
 */
public class Job {

    private AVObject jobObject;
    private AVUser publishAVUser;//对应的是发布这条信息的企业版用户
    private String jobName;
    private int jobType;
    private String workDate;//对工作日期的描述
    private String workTime;//对工作时间的描述
    private String requestNum;
    private int payType;
    private String salary;
    private String describe;
    private int genderRequest;
    private int heightRequest;
    private String contactEmail;
    private String contactPhone;
    private String contactName;
    private String workAddress;
    private int cityId;
    private int provinceId;
    private int regionId;
    private int jobState;
    private Date createdAt;
    private String objectId;

    public static final String JOB_TABLE = "job";


    public Job(AVObject jobObject) {
        this.jobObject = jobObject;
        this.objectId = jobObject.getObjectId();
        this.contactEmail = jobObject.getString("contactEmail");
        this.contactPhone = jobObject.getString("contactPhone");
        this.describe = jobObject.getString("describe");
        this.genderRequest = jobObject.getInt("genderRequest");
        this.heightRequest = jobObject.getInt("heightRequest");
        this.jobName = jobObject.getString("jobName");
        this.payType = jobObject.getInt("payType");
        this.jobType = jobObject.getInt("jobType");
        this.requestNum = jobObject.getString("requestNum");
        this.salary = jobObject.getString("salary");
        this.publishAVUser = jobObject.getAVUser("publishAVUser");
        this.workAddress = jobObject.getString("workAddress");
        this.workDate = jobObject.getString("workDate");
        this.workTime = jobObject.getString("workTime");
        this.cityId = jobObject.getInt("cityId");
        this.provinceId = jobObject.getInt("provinceId");
        this.regionId = jobObject.getInt("regionId");
        this.contactName = jobObject.getString("contactName");
        this.jobState = jobObject.getInt("jobState");
        createdAt = jobObject.getDate("createdAt");
    }

    public Job() {
        this.jobObject = new AVObject(JOB_TABLE);

    }

    public String getContactEmail() {
        return contactEmail;
    }

    public void setContactEmail(String contactEmail) {
        this.contactEmail = contactEmail;
    }

    public String getContactPhone() {
        return contactPhone;
    }

    public void setContactPhone(String contactPhone) {
        this.contactPhone = contactPhone;
    }

    public String getDescribe() {
        return describe;
    }

    public void setDescribe(String describe) {
        this.describe = describe;
    }

    public String getJobName() {
        return jobName;
    }

    public void setJobName(String jobName) {
        this.jobName = jobName;
    }

    public AVObject getJobObject() {
        return this.jobObject;
    }


    public AVObject saveJobObject() {

        this.jobObject.put("contactEmail", contactEmail);
        this.jobObject.put("contactPhone", contactPhone);
        this.jobObject.put("describe", describe);
        this.jobObject.put("genderRequest", genderRequest);
        this.jobObject.put("jobName", jobName);
        this.jobObject.put("payType", payType);
        this.jobObject.put("jobType", jobType);
        this.jobObject.put("requestNum", requestNum);
        this.jobObject.put("salary", salary);
        this.jobObject.put("publishAVUser", publishAVUser);
        this.jobObject.put("workAddress", workAddress);
        this.jobObject.put("workDate", workDate);
        this.jobObject.put("workTime", workTime);
        this.jobObject.put("contactName", contactName);
        this.jobObject.put("provinceId",provinceId);
        this.jobObject.put("cityId",cityId);
        this.jobObject.put("regionId",regionId);
        this.jobObject.put("jobState",jobState);

        return this.jobObject;
    }

    public void setJobObject(AVObject jobObject) {
        this.jobObject = jobObject;
    }



    public String getRequestNum() {
        return requestNum;
    }

    public void setRequestNum(String requestNum) {
        this.requestNum = requestNum;
    }

    public String getWorkAddress() {
        return workAddress;
    }

    public void setWorkAddress(String workAddress) {
        this.workAddress = workAddress;
    }

    public String getWorkDate() {
        return workDate;
    }

    public void setWorkDate(String workDate) {
        this.workDate = workDate;
    }

    public String getWorkTime() {
        return workTime;
    }

    public void setWorkTime(String workTime) {
        this.workTime = workTime;
    }



    public String getContactName() {
        return contactName;
    }

    public void setContactName(String contactName) {
        this.contactName = contactName;
    }

    public String getSalary() {
        return salary;
    }

    public void setSalary(String salary) {
        this.salary = salary;
    }

    public AVUser getPublishAVUser() {
        return publishAVUser;
    }

    public void setPublishAVUser(AVUser publishAVUser) {
        this.publishAVUser = publishAVUser;
    }



    public Date getCreatedAt() {
        return createdAt;
    }


    public int getCityId() {
        return cityId;
    }

    public void setCityId(int cityId) {
        this.cityId = cityId;
    }

    public int getGenderRequest() {
        return genderRequest;
    }

    public void setGenderRequest(int genderRequest) {
        this.genderRequest = genderRequest;
    }

    public int getHeightRequest() {
        return heightRequest;
    }

    public void setHeightRequest(int heightRequest) {
        this.heightRequest = heightRequest;
    }

    public int getJobState() {
        return jobState;
    }

    public void setJobState(int jobState) {
        this.jobState = jobState;
    }

    public int getJobType() {
        return jobType;
    }

    public void setJobType(int jobType) {
        this.jobType = jobType;
    }

    public int getPayType() {
        return payType;
    }

    public void setPayType(int payType) {
        this.payType = payType;
    }

    public int getProvinceId() {
        return provinceId;
    }

    public void setProvinceId(int provinceId) {
        this.provinceId = provinceId;
    }

    public int getRegionId() {
        return regionId;
    }

    public void setRegionId(int regionId) {
        this.regionId = regionId;
    }

    public String getObjectId() {
        return objectId;
    }

    public void setObjectId(String objectId) {
        this.objectId = objectId;
    }
}
